package com.lianjia.sh.se.esb.server.action;

import com.lianjia.sh.se.esb.spi.model.Message;
import org.springframework.aop.support.AopUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by yangsp1 on 16/7/20.
 */
@Service
public class ProxyInvokeSupport {
    @Autowired
    List<MessageAction> messageActions = new ArrayList<>();

    public void executeMessage(MessageAction messageAction,Message message){
        if(AopUtils.isAopProxy(messageAction)) {
            messageAction.executeMessage(message);
        }else{
            for(MessageAction messageActionProxy :messageActions){
                if(AopUtils.isAopProxy(messageActionProxy) ){
                    if(AopUtils.isJdkDynamicProxy(messageActionProxy)) {
                        System.out.println("sss");
                    } else { //cglib
                        System.out.println("sss");
                    }
                }
            }
        }
    }
}

